<?php

class RequestsController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }

    public function cancelcaseAction()
    {
        $num_solicitud = $this->getRequest()->getParam('NUM_SOLICITUD');
        $justify = $this->getRequest()->getParam('justify');
        $model = new Model_Requests();
        $cancel = $model->cancelCasesByRequest($num_solicitud);
        if(!is_nan($cancel)){
            $model->setCanceledRequest($num_solicitud);
            $model->setJustifyCancelRequest($num_solicitud, $justify);
            $success = true;
            $msg = 1;
        }else{
            $success = false;
            $msg = 'Error al cancelar el caso';
        }
        $response = array(
            'success' => $success,
            'msg' => $msg
        );
        $this->_helper->json->sendJson($response);
    }


}



